class CategoryBigModel {
  String mallCategoryId; //类别编号
  String mallCategoryName; //类别名称
  List<BxMallSubDto> bxMallSubDto; //小类列表
  String image; //类别图片
  Null comments; //列表描述

  //构造函数
  CategoryBigModel(
      {this.mallCategoryId,
      this.mallCategoryName,
      this.comments,
      this.image,
      this.bxMallSubDto});

  // factory 关键字: 当实现构造函数但是不想每次创建该类的一个实例的时候
  factory CategoryBigModel.fromJson(dynamic jsonData) {
    return CategoryBigModel(
        mallCategoryId: jsonData['mallCategoryId'],
        mallCategoryName: jsonData['mallCategoryName'],
        comments: jsonData['comments'],
        image: jsonData['image'],
        bxMallSubDto: (jsonData['bxMallSubDto'] as List).cast().map((item) {
          return BxMallSubDto.fromJson(item);
        }).toList());
  }
}

class CategoryBigListModel {
  List<CategoryBigModel> data;
  CategoryBigListModel(this.data);

  factory CategoryBigListModel.fromJson(List json) {
    return CategoryBigListModel(json.map((item) {
      return CategoryBigModel.fromJson(item);
    }).toList());
  }
}

class BxMallSubDto {
  String comments;
  String mallCategoryId;
  String mallSubId;
  String mallSubName;

  BxMallSubDto(
      {this.comments, this.mallCategoryId, this.mallSubId, this.mallSubName});

  factory BxMallSubDto.fromJson(dynamic json) {
    return BxMallSubDto(
        comments: json["comments"] ?? "",
        mallCategoryId: json["mallCategoryId"],
        mallSubId: json["mallSubId"],
        mallSubName: json["mallSubName"]);
  }
}

class CategoryGoodsModel {
  double oriPrice;
  double presentPrice;
  String image;
  String goodsName;
  String goodsId;

  CategoryGoodsModel(
      {this.goodsId,
      this.presentPrice,
      this.image,
      this.goodsName,
      this.oriPrice});

  factory CategoryGoodsModel.fromJson(dynamic json) {
    return CategoryGoodsModel(
        goodsId: json["goodsId"],
        presentPrice: json["presentPrice"],
        image: json["image"],
        goodsName: json["goodsName"],
        oriPrice: json["oriPrice"]);
  }
}
